package com.junqson.je.recruit.repo;

import com.junqson.je.recruit.model.JobModel;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Descriptions
 * @Company
 * @Author Junqson
 * @Date 2020/2/3 19:29
 * @Version 1.0
 */
@Repository
public interface JobRepo extends JpaRepository<JobModel, Integer> {
    JobModel findByJobId(Integer jobId);

    List<JobModel> findByPublisherIdOrderByPublishTimeDesc(Integer publisherId);

    List<JobModel> findByPublisherIdAndClosedFalseOrderByPublishTimeDesc(Integer publisherId);

    Page<JobModel> findAllByClosedFalse(Pageable pageable);

    Page<JobModel> findByLocationAndClosedFalse(String location, Pageable pageable);

    Page<JobModel> findByCategoryAndClosedFalse(String category, Pageable pageable);

    Page<JobModel> findByLocationAndCategoryAndClosedFalse(String location, String category, Pageable pageable);

}
